package com.gxa.financial.controller;

import com.gxa.common.R;
import com.gxa.common.entity.financial_management.PayRecord;
import com.gxa.financial.service.PayRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/payRecord")
public class PayRecordController {

    @Autowired
    private PayRecordService payRecordService;


    //分页查询
    @GetMapping("/selectPayRecordList")
    public R selectPayRecordList(Integer currentPage, Integer pageSize){
        return payRecordService.selectPayRecordList(currentPage,pageSize);
    }
    //条件查询
    @GetMapping("/selectPayRecord")
    public R selectPayRecord(Integer currentPage, Integer pageSize, PayRecord payRecord){
        return payRecordService.selectPayRecord(currentPage,pageSize,payRecord);
    }

    //根据交易号查询详情
    @GetMapping("/selectPayRecordByNo")
    public R selectPayRecordByNo(Long transactionNo){
        return payRecordService.selectPayRecordByNo(transactionNo);
    }

    //支付成功后修改支付状态
    @PostMapping("/updatePayRecordStatus")
    public R updatePayRecordStatus(@RequestBody PayRecord payRecord){
        return payRecordService.updatePayRecordStatus(payRecord);
    }

    //支付失败，交易关闭
    @PostMapping("/updatePayRecordFailStatus")
    public R updatePayRecordFailStatus(@RequestBody PayRecord payRecord){
        return payRecordService.updatePayRecordFailStatus(payRecord);
    }

    //添加支付记录
    @PostMapping("/addPayRecord")
    public R addPayRecord(@RequestBody PayRecord payRecord){
        return payRecordService.addPayRecord(payRecord);
    }

    //更具订单号查订单
    @GetMapping("/selectOrder")
    public R selectOrder(Long orderNo){
        return null;
    }


}
